package pl.koziolekweb.gallerygenerator;

import java.util.List;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import pl.koziolekweb.gallerygenerator.model.Obrazek;

/**
 * 
 * @author koziolek
 * 
 * 
 *         Info: $Id: ToXMLProcessor.java 116 2009-02-17 19:52:15Z bjkuczynski $
 */
public class ToXMLProcessor implements Processor {

	private static final String ROOT = "obrazki";
	private Document document;

	public void process(List<Obrazek> obrazki) {
		try {
			document = DocumentBuilderFactory.newInstance()
					.newDocumentBuilder().newDocument();
		} catch (ParserConfigurationException e) {
			e.printStackTrace();
		}
		if(document==null)
			throw new NullPointerException();
		
		Element root = document.createElement(ROOT);
		document.appendChild(root);
	}
}
